﻿<!DOCTYPE html>
<!--培训记录管理列表-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>
    <style>
        .el-table__body-wrapper table tbody tr td {
            text-align: center;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak class="popupW50">
        <el-form ref="form" :inline="true" label-position="right" label-width="100px" :model="formInline"
            class="demo-form-inline" style="margin-bottom: 15px;">

            <el-row>
                <el-col class="head-tool">
                    
<div class="new_title fl"><strong><img src="/static/images/icon1.png" />培训记录列表</strong></div>
<span>
    <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="3" @click="onSubmit">
    </btn>
    <btn :text="col.btnAdd" linetype="3" @click="UserInput('tj')"></btn>
    <!--<btn :text="col.btnBatchImport" imgsrc="/static/images/general.png" linetype="3" @click="onSubmit">
    </btn>-->
    <btn-uploadfile-list url="/api/CBS_TrainRecord/Import" linetype="3"></btn-uploadfile-list>
    <btn-export-list url="/api/CBS_TrainRecord/Export" :forminline="this.formInline" linetype="3">
    </btn-export-list>
    <btn :text="col.btnDelete" linetype="4" @click="onDelete"></btn>
</span>
                </el-col>
            </el-row>
            <el-row>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{TrainingRecord.TrainingCoursewareName+mark.m}}
                                </template>
                                <el-select @visible-change="visibleChange" v-model="formInline.model.cbsCourseId" slot="suffix"
                                    :placeholder="TrainingRecord.TrainingCoursewareName">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in TrainingCoursewareName" :label="item.trainingCoursewareName"
                                        :value="item.id"></el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{TrainingRecord.Type+mark.m}}
                                </template>
                                <el-select @visible-change="visibleChange" v-model="formInline.model.mark01" slot="suffix"
                                    :placeholder="TrainingRecord.Type">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in Type" :label="item.value"
                                        :value="item.key"></el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
        </el-form>

        <el-table stripe ref="table" :data="ListItem.tableData" :height="ListItem.tableHeight" border
            @selection-change="handleSelectionChange" row-style="height:10px" style="width: 100%">
            <el-table-column type="selection" align="center" width="55">
            </el-table-column>
            <el-table-column type="index" :label="ContractorDirectory.SerialNumber" :index="indexMethod" width="50"
                show-overflow-tooltip="true"></el-table-column>

            <el-table-column prop="cbS_Course.trainingCoursewareName" :label="TrainingRecord.TrainingCoursewareName"
                show-overflow-tooltip="true" min-width="300">
            </el-table-column>
            <el-table-column prop="mark01" :label="TrainingRecord.Type" min-width="80">
            </el-table-column>
            <el-table-column prop="trainerText" :label="TrainingRecord.Trainer" min-width="120">
            </el-table-column>

            <el-table-column prop="trainingDate" :label="TrainingRecord.TrainingDate" :formatter="myformatDate" min-width="150">
            </el-table-column>
            <el-table-column prop="cbS_List.contractorName" :label="TrainingRecord.contractor" min-width="200">
            </el-table-column>
            <el-table-column prop="mark02" :label="TrainingRecord.participant"
                             show-overflow-tooltip="true" min-width="300">
                <!--:formatter="getDicValue"-->
            </el-table-column>
            <el-table-column prop="createUserText" :label="TrainingRecord.editor" min-width="120">
            </el-table-column>
            <el-table-column prop="createTime" :label="TrainingRecord.editorTime" :formatter="myformatDate" show-overflow-tooltip="true"
                min-width="100">
            </el-table-column>
            <el-table-column prop="remarks" :label="TrainingRecord.Remarks" show-overflow-tooltip="true"
                min-width="100">
            </el-table-column>
            <!--<el-table-column prop="Remarks"
                             :label="TrainingRecord.Remarks">
            </el-table-column>-->
            <el-table-column width="53" prop="update" :label="col.btnUpdate" fixed="right">
                <template slot-scope="scope">
                    <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.id)>
                        <i class="el-icon-edit"></i>
                    </button>
                </template>
            </el-table-column>
        </el-table>
        <el-row type="flex" justify="end">
            <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
                :layout="ListItem.layout" :total="ListItem.total">
            </el-pagination>
        </el-row>
        <el-dialog title="培训记录管理" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%" height="80%"
            top="10vh" fullscreen="true">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script type="text/javascript">
        app = new Vue({
            el: '#app',
            data: function () {
                return {
                    //mydata: PersonInChargeTree,
                    TrainingCoursewareName: [],
                    Type: [{ key: '入场培训', value: '入场培训' }, { key: '复训', value: '复训' }, { key: '专业知识', value: '专业知识' }],
                    ListItem: ListItem,
                    formInline: {
                        model: {
                            cbsCourseId: '',
                            mark01: '',
                            Trainer: '',
                            TrainingDate: '',
                            participant: '',
                            editor: '',
                            editorTime: '',
                            Remarks: ''
                        },
                        offset: 0,
                        limit: 10
                    }
                }
            }, created: function () {
                var currApp = this;
                window.onresize = function () {
                    currApp.ListItem.tableHeight = window.innerHeight -
                        currApp.$refs.table.$el.offsetTop - 60;
                    if (currApp.ListItem.tableHeight < 112) {
                        currApp.ListItem.tableHeight = 112;
                    }
                }
            },
            mounted: function () {
                //获取下拉菜单内容
                //this.TrainingCoursewareName = getDicData('54');
                this.getClassList();
                //this.Type = getDicData('n101');
                //初始化数据
                this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                getDicValue: function (row, column, cellValue, index) {
                    if (cellValue) {
                        if (typeof cellValue === 'string' || typeof cellValue === 'number') {
                            return getTreeValue(this.mydata, cellValue)
                        }
                        else {
                            var result = '';
                            for (var i = 0; i < cellValue.length; i++) {
                                result += getTreeValue(this.mydata, cellValue[i]) + ',';
                            }
                            result = result.substr(0, result.length - 1);
                            return result;
                        }
                    }

                },
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },
                handleNodeClick: function (data) {
                    console.log(data);
                },
                closeDialog: function () { closeDialog(this); },
                //删除方法
                onDelete: function () { onDelete(this, '/api/CBS_TrainRecord/DeleteMuti'); },
                //列表选择触发
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //Dialog展示
                UserInput: function (val, id) { DialogShow(this, val, "TrainingRecordManagementInput.html", id); },
                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/CBS_TrainRecord/GetList') },
                //查询方法
                onSubmit: function () { onSubmit(this); },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },
                //初始化课件
                getClassList: function () {
                    var mythis = this;
                    myAjax("post", this, '/api/CBS_Course/GetList', { model: { createFactory: null }, offset: 0, limit: 100 }, function (response) {
                        mythis.TrainingCoursewareName = response.data.pageData;

                        //console.log(response.data.pageData);
                    }, false);
                },

            }
        });

    </script>
</body>

</html>